package com.xd.cloud.dao.core;

import com.xd.cloud.dao.BaseDao;
import com.xd.cloud.entity.core.UserDataAuthority;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author wangtao
 * @class_name UserDataAuthorityDao
 * @description 用户与数据权限持久层
 * @create 2017/12/27
 */
@Repository
public class UserDataAuthorityDao extends BaseDao<UserDataAuthority> {

    public List<UserDataAuthority> getUserDataAuthorityByUserId(Integer userId) {
        String hql = "from UserDataAuthority where userid = ?";
        return find(hql, new Object[]{userId});
    }

    public Integer delUserDataAuthorityByUserId(Integer userId) {
        String hql = "delete from UserDataAuthority where user.id = ?";
        return execute(hql, new Object[]{userId});
    }
}
